#ifndef UART_H
#define UART_H

#define setbit(reg,n)  ((reg) |= (1<<(n)))
#define clrbit(reg,n)  ((reg) &= ~(1<<(n)))
#define chkbit(reg,n)  ((reg) & (1<<(n)))

#define		IOCON_PIO1_6		(*(volatile unsigned int*)0x400440A4)
#define		IOCON_PIO1_7		(*(volatile unsigned int*)0x400440A8)
#define		SYSAHBCLKCTRL		(*(volatile unsigned int*)0x40048080)
#define		UARTCLKDIV	 		(*(volatile unsigned int*)0x40048098)

#define		U0FDR	 			(*(volatile unsigned int*)0x40008028)
#define		U0DLL	 			(*(volatile unsigned int*)0x40008000)
#define		U0DLM	 			(*(volatile unsigned int*)0x40008004)
#define		U0LSR	 			(*(volatile unsigned int*)0x40008014)
#define		U0THR	 			(*(volatile unsigned int*)0x40008000)
#define		U0RBR	 			(*(volatile unsigned int*)0x40008000)
#define		U0LCR	 			(*(volatile unsigned int*)0x4000800C)
#define		U0IER	 			(*(volatile unsigned int*)0x40008004)
	
void uart_init(void);
void SendToUart(char c);
char RecvFromUart(void);
void led_on(int n);

void led_off(int n);
void delay_ms(unsigned int ms);
void led_init(void);
#endif
